package com.power.sifa.approve.model.doc;

import cn.hutool.core.util.ObjectUtil;
import com.power.sifa.approve.model.enumeration.Tp_procmaterial;
import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * @ClassName AdmreAuditAppendNoticeDoc
 * @Author xiongzw
 * @Date 2023/11/23 16:07
 * @Description 补正行政复议申请通知书
 * @Version: 1.0
 **/

@Data
public class AdmreAuditAppendNoticeDoc extends AbstractDoc {

    /**
     * 申请人
     */
    private String apl_admre_audit_applyname;

    /**
     * 内容
     */
    private String content;

    /**
     * 陈述
     */
    private String statement;

    private final static String TEMPLATE = "    {pronoun}对{apl_admre_audit_targetname}[{behavior}]{prcode}不服，于{apl_main_subtime}向本府提出行政复议申请。经审查，本府认为：该行政复议申请（如复议请求不明确，材料不齐全等），需要补正以下材料：（应注明需补正的材料要求）。";

    private final static String STATEMENT_TEMPLATE = "    请{pronoun}接到本通知书后，于xx日内补正申请材料。根据《中华人民共和国行政复议法实施条例》第二十九条的规定，补正申请材料所用时间不计入行政复议审理期限。无正当理由逾期不补正的，视为放弃行政复议申请。";


    public AdmreAuditAppendNoticeDoc() {
        super();
        this.setDocType(Tp_procmaterial.ADMRE_APPEND);
    }

    public AdmreAuditAppendNoticeDoc(String applyid) {
        super(applyid);
        this.setDocType(Tp_procmaterial.ADMRE_APPEND);
    }

    public AdmreAuditAppendNoticeDoc(String applyid, String apl_admre_audit_applyname, String content, String statement) {
        super(applyid);
        this.setDocType(Tp_procmaterial.ADMRE_APPEND);
        this.apl_admre_audit_applyname = apl_admre_audit_applyname;
        this.content = content;
        this.statement = statement;
    }

    @Override
    public AbstractDoc generateTemplate(String applyid) {
        AdmreAuditAcceptNoticeDoc template = new AdmreAuditAcceptNoticeDoc(applyid);
        // 案号
        template.setApl_admre_audit_code(this.getApl_admre_audit_code());
        template.setApl_admre_audit_applyname(ObjectUtil.isNotNull(this.getAdmreObj()) ? this.getAdmreObj().getApplyname() : "");
        String content  = TEMPLATE.replace("{apl_admre_audit_targetname}", ObjectUtil.isNotNull(this.getAdmreObj()) ?
                this.getAdmreObj().getTargetname() : "" );
        content = content.replace("{pronoun}", this.transPronoun());
        content = content.replace("{behavior}", this.transBehavior());
        content = content.replace("{prcode}", this.transPrcode());
        content = content.replace("{apl_main_subtime}", this.transSubtime());
        template.setContent(content);
        String statement = STATEMENT_TEMPLATE.replace("{pronoun}", this.transPronoun());
        template.setStatement(statement);
        return template;
    }

}
